//
//  MembershipViewController.m
//  YuanCheng
//
//  Created by dongshangtong on 16/4/6.
//  Copyright © 2016年 dongshangtong. All rights reserved.
//  医生审核状态界面

#import "MembershipViewController.h"
#import "YCTabbarViewController.h"

#import "AuditView.h"
#import "ApprovedView.h"
#import "MyProfileModel.h"
#import "MyCertificate.h"
@interface MembershipViewController ()

@end

@implementation MembershipViewController


//医生获取证书信息接口 参数expert_id
- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.navigationController.navigationBar.hidden = NO;
    self.navigationItem.title=@"审核最新状态";
    
    NSUserDefaults *def = [NSUserDefaults standardUserDefaults];
    
    NSString *  statuCode = [def objectForKey:KCHECKFLAG];
    

    
    if ([statuCode isEqualToString:@"1"]) {
        
        self.navigationItem.title=@"我的证书";

        ApprovedView *approView = [[[NSBundle mainBundle] loadNibNamed:@"ApprovedView" owner:nil options:nil] lastObject];
        
        
        approView.frame=CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
        
        [self.view addSubview:approView];
        

    }
    else
    {
        
        AuditView *udit = [[[NSBundle mainBundle] loadNibNamed:@"AuditView" owner:nil options:nil] lastObject];
        
        udit.click = ^(void){
        
        
            if (self.popType == MEMBER_SHIP_POP_TYPE_TAB)
            {
                
                
                UIWindow *window = [UIApplication sharedApplication].keyWindow;
                window.rootViewController= [[YCTabbarViewController alloc]init];
                
                
            }else  {
                
                [self.navigationController popToRootViewControllerAnimated:YES];
                
            }
        
        };
        
        NSString *linkMobile= [def objectForKey:KLINKMOBILE];
        NSDictionary  *params = @{
                                  @"link_mobile":linkMobile,
                                  @"yw_id":yw_id
                                  };
    
        [DownloadData post:kAuthStatusDetail params:params success:^(id json) {
            
            NSDictionary *dict = [json objectAtIndex:0];
    
            if (dict) {
                
                udit.userName.text = [NSString  stringWithFormat:@"%@ 您好!",dict[@"EXPERT_NAME"]];
                udit.moblephone.text = [NSString  stringWithFormat:@"%@",dict[@"LINK_MOBILE"]];
                
                if ([dict[@"HOS_NAME"] length])
                {
                    udit.hosName.hidden = NO;
                    udit.hosName.text = [NSString  stringWithFormat:@"%@",dict[@"HOS_NAME"]];
                    
                }else
                {
                    udit.hosName.hidden = YES;
                }
            }
        } failure:^(NSError *error) {
            
        }];
        
        
        udit.frame=CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
        if (self.btnStatus == MEMBER_CHECK_DETAIL_BTN_HIDDEN_STATUS_NO)
        {
            udit.lookBtn.hidden=NO;

        }
        
        [self.view addSubview:udit];
        
    }
    
}


@end
